<?php

use App\Http\Controllers\Home\HomeController;
use Illuminate\Support\Facades\Route;
//引入Index模块下的IndexController控制器
use App\Http\Controllers\Index\IndexController;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

//Route::get('/', function () {
//    return view('welcome');
//});

Route::get('/', [HomeController::class, 'index']);

//访问http://study.laravel.com/index
//http://study.laravel.com/index/11111111111111
Route::get('/index/{id?}', [IndexController::class, 'index'])->middleware('Test');


//访问index模块下的方法，路由分组
//访问http://study.laravel.com/index/index
Route::middleware(['Test'])->prefix('index')->group(function () {
    //让某个特定的路由不经过中间件，请在路由定义之前使用Route::withoutMiddleware()方法
    Route::withoutMiddleware(['Test'])->get('/index', [IndexController::class, 'index']);
    // 经过中间件‘Test’
    Route::get('/index/{id?}', [IndexController::class, 'index']);
});
